package cn.bblocks.common.i18n.demo.controller;


import cn.bblocks.common.i18n.demo.util.I18nUtil;
import cn.bblocks.common.i18n.demo.util.R;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * <p>Project: bb-i18n - TestController</p>
 * <p>描述：测试用</p>
 *
 * @Author Zhao [125043150@qq.com]
 * @Date 2024/4/1 17:44
 * @Version 1.0
 * @since 8
 */
@RestController
@RequestMapping("/demo")
public class TestController {

    @GetMapping("/xxx")
    public R xxx1() {
        return R.ok("Hello，World");
    }

    @GetMapping("/i18n")
    public String i18n(HttpServletRequest request) {
        String message1 = I18nUtil.getMessage("A00001", request.getHeader("lang"));
        String message2 = I18nUtil.getMessage("A00002", request.getHeader("lang"));
        return message1 + message2;
    }


}
